using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using Wikey.Domain.Components;
using Wikey.Domain.Repository;
using Wikey.Entity;

namespace Wikey.Web.Mvc.Controllers
{
    public class TagsController : Controller
    {
        //
        // GET: /Tag/

        public ActionResult Index()
        {
            ViewData.Model = Factory.Get<ITagRepository>().SelectAll();
            return View();
        }

        public ActionResult Look( string tag )
        {
            Tag t = Factory.Get<ITagRepository>().Find(tag);
            if ( t!= null )
            {
                t.TaggedPages = Factory.Get<IPageRepository>().FindByTag(tag);
            }
            ViewData.Model = t;
            return View();
        }

    }
}
